package com.arpa.wms.mapper;

import com.arpa.wms.domain.dto.ReceiveItemDTO;
import com.arpa.wms.domain.entity.ReceiveItem;
import com.arpa.wms.domain.vo.ReceiveItemVO;
import com.arpa.wms.domain.vo.ReceiveItemWithRegisterVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 收货明细 Mapper 接口
 * </p>
 *
 * @author LEO
 * @since 2020-08-04
 */
public interface ReceiveItemMapper extends BaseMapper<ReceiveItem> {

    /**
     * 查询列表
     * @param receiveItemDTO
     * @return
     */
    List<ReceiveItemVO> queryList(ReceiveItemDTO receiveItemDTO);

    List<ReceiveItemVO> getReceiveItemByGoods(@Param("list") List<String> list);

    /**
     * 查询合计,包含总数
     * @param receiveItemDTO
     * @return
     */
    ReceiveItemVO queryListSum(ReceiveItemDTO receiveItemDTO);

    List<ReceiveItemVO> queryWithReceiveList(ReceiveItemDTO receiveItemDTO);

    List<ReceiveItemWithRegisterVO> queryItemWithRegisterList(ReceiveItemDTO receiveItemDTO);

    List<ReceiveItemWithRegisterVO> queryItemWithRegisterListByPaging(ReceiveItemDTO receiveItemDTO);

    List<ReceiveItem> queryItemList(ReceiveItemDTO receiveItemDTO);

    /**
     * 关联查询获取退货单明细列表
     * @param receiveItemDTO
     * @return
     */
    List<ReceiveItemVO> queryReturnList(ReceiveItemDTO receiveItemDTO);

    /**
     * 统计收货确认单上架数量，更新指定收货明细单的上架数量
     * @param receiveItemCode
     * @param registerStatus
     */
    void refreshPutawayQuantity(@Param("code") String receiveItemCode, @Param("registerStatus") String registerStatus, @Param("groupCode") String groupCode);

    /**
     * 统计收货确认单上架数量，更新指定收货明细单的上架和入库数量
     * @param receiveItemCode
     * @param registerStatus
     */
    void refreshPutawayAndInboundQuantity(@Param("code") String receiveItemCode, @Param("registerStatus") String registerStatus, @Param("groupCode") String groupCode);

    /**
     * 查询明细、收货登记信息， 带分页逻辑
     * @param receiveItemDTO
     * @return
     */
    List<ReceiveItemWithRegisterVO> queryItemWithRegisterListWithPage(ReceiveItemDTO receiveItemDTO);
}
